#!/bin/bash
# curl -sSO https://gitee.com/mayunzq/public-shellscript/raw/master/CentOS7/pve-create-vm.sh
ip_no4=$1
server_name=$2

vm_gateway=192.168.200.1
vm_ip=192.168.200.${ip_no4}
vm_id=$(echo ${vm_ip} | awk -F"." '{print $3}')$(printf "%03d\n" ${vm_ip##*.})

qm clone 9000 ${vm_id} --name ${server_name}
qm set ${vm_id} --ipconfig0 ip=${vm_ip}/24,gw=${vm_gateway}